package org.example.css;

import org.example.css.config.AppConfig;
import org.example.css.service.CarService;
import org.example.css.service.impl.UserService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;

/**
 * 启动测试类
 */
public class Main {

	public static void main(String[] args) {

		test2();
	}


	static void test1(){
		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Main.class);

		CarService carService = context.getBean(CarService.class);

		System.out.println(carService.getColor());
		System.out.println(carService.getBrand());
	}
	static void test2(){
		System.out.println("Hello and welcome!");

		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
		UserService userService = (UserService) context.getBean("userService");

		userService.stdout();
	}
}
